using System.Data.Entity.ModelConfiguration;

namespace OBUCare.Core.Models.Mapping
{
    public class View_PARTS_SALEMap : EntityTypeConfiguration<View_PARTS_SALE>
    {
        public View_PARTS_SALEMap()
        {
            // Primary Key
            this.HasKey(t => new { t.ID});

            // Properties
         

            this.Property(t => t.OBU_NO)
                .IsRequired()
                .HasMaxLength(16);

            this.Property(t => t.VEHICLE_PLATE_NO)
                .HasMaxLength(12);

            this.Property(t => t.USER_NO)
                .IsRequired()
                .HasMaxLength(16);

            this.Property(t => t.USER_NAME)
                .HasMaxLength(120);



            this.Property(t => t.PARTS_NAME)
                .HasMaxLength(50);

   

            this.Property(t => t.SUPPLIER_NAME)
                .IsRequired()
                .HasMaxLength(50);



            this.Property(t => t.SPEC_NAME)
                .IsRequired()
                .HasMaxLength(50);

            this.Property(t => t.AGENT_NO)
                .IsRequired()
                .HasMaxLength(16);

            this.Property(t => t.AGENT_NAME)
                .HasMaxLength(50);

            this.Property(t => t.AGENT_TYPE_NO)
                .IsFixedLength()
                .HasMaxLength(2);
                   

            this.Property(t => t.CREATED_BY)
                .IsRequired()
                .IsFixedLength()
                .HasMaxLength(6);

            this.Property(t => t.Modify_by)
                .IsRequired()
                .IsFixedLength()
                .HasMaxLength(6);

            this.Property(t => t.OPERATOR_NAME)
                .HasMaxLength(50);

            this.Property(t => t.REMARK)
                .IsRequired()
                .HasMaxLength(50);

            // Table & Column Mappings
            this.ToTable("View_PARTS_SALE");
            this.Property(t => t.ID).HasColumnName("ID");
            this.Property(t => t.OBU_NO).HasColumnName("OBU_NO");
            this.Property(t => t.VEHICLE_PLATE_NO).HasColumnName("VEHICLE_PLATE_NO");
            this.Property(t => t.OBU_REGISTE_DATE).HasColumnName("OBU_REGISTE_DATE");
            this.Property(t => t.USER_NO).HasColumnName("USER_NO");
            this.Property(t => t.USER_NAME).HasColumnName("USER_NAME");
            this.Property(t => t.PARTS_ID).HasColumnName("PARTS_ID");
            this.Property(t => t.PARTS_NAME).HasColumnName("PARTS_NAME");
            this.Property(t => t.SUPPLIER_ID).HasColumnName("SUPPLIER_ID");
            this.Property(t => t.SUPPLIER_NAME).HasColumnName("SUPPLIER_NAME");
            this.Property(t => t.PARTS_SPEC_ID).HasColumnName("PARTS_SPEC_ID");
            this.Property(t => t.SPEC_NAME).HasColumnName("SPEC_NAME");
            this.Property(t => t.AGENT_NO).HasColumnName("AGENT_NO");
            this.Property(t => t.AGENT_NAME).HasColumnName("AGENT_NAME");
            this.Property(t => t.AGENT_TYPE_NO).HasColumnName("AGENT_TYPE_NO");
            this.Property(t => t.AMOUNT).HasColumnName("AMOUNT");
            this.Property(t => t.REPORT_DATE).HasColumnName("REPORT_DATE");
            this.Property(t => t.STATUS).HasColumnName("STATUS");
            this.Property(t => t.CREATED_BY).HasColumnName("CREATED_BY");
            this.Property(t => t.CREATED_DATE).HasColumnName("CREATED_DATE");
            this.Property(t => t.Modify_by).HasColumnName("Modify_by");
            this.Property(t => t.OPERATOR_NAME).HasColumnName("OPERATOR_NAME");
            this.Property(t => t.Modify_date).HasColumnName("Modify_date");
            this.Property(t => t.REMARK).HasColumnName("REMARK");
        }
    }
}
